package com.huang.foundation.crawler;

import com.huang.foundation.entity.po.ZoningCodePO;
import com.huang.foundation.service.ZoningCodeService;
import org.springframework.stereotype.Component;
import us.codecraft.webmagic.ResultItems;
import us.codecraft.webmagic.Task;
import us.codecraft.webmagic.pipeline.Pipeline;

import javax.annotation.Resource;
import java.util.ArrayList;

/**
 * @author HuangShen
 * @Description
 * @create 2021-09-19 9:12
 */
@Component
public class ZoningCodePipeline implements Pipeline {

    @Resource
    private ZoningCodeService zoningCodeService;

    @Override
    public void process(ResultItems resultItems, Task task) {
        ArrayList<ZoningCodePO> database = resultItems.get("data");
        zoningCodeService.saveBatch(database);

    }
}
